package com.hmall.api.user;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable cause) {
        return new UserClient(){
            @Override
            public void deductMoney(Long userId, String pw, Integer amount) {
                log.warn("扣减用户余额失败, 执行降级策略");
            }
        };
    }
}
